StackExchange.Redis.RedisTimeoutException · Issue #2130 · StackExchange/StackExchange.Redis · GitHub 您所在的位置:网站首页 timeout performing GET StackExchange.Redis.RedisTimeoutException · Issue #2130 · StackExchange/StackExchange.Redis · GitHub

StackExchange.Redis.RedisTimeoutException · Issue #2130 · StackExchange/StackExchange.Redis · GitHub

2024-06-02 17:18| 来源: 网络整理| 查看: 265

Using StackExchange.Redis version 2.5.61 with a .NET Framework 4.8 Web Project and Azure Cache for Redis I continually get the following error: Timeout performing SET (10000ms), inst: 0, qu: 1, qs: 0, aw: False, bw: SpinningDown, rs: NotStarted, ws: Idle, in: 0, serverEndpoint: XXXX.redis.cache.windows.net:6380, mc: 1/1/0, mgr: 10 of 10 available, clientName: XXXX(SE.Redis-v2.5.61.22961), IOCP: (Busy=2,Free=998,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=1,Max=32767), v: 2.5.61.22961 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)

I have the following class setup as a singleton service to connect to redis and take/release locks:

public class RedisClientService : IRedisClientService { private static Lazy _redisConnection; public RedisClientService() { var redisConnectionString = ConfigurationManager.AppSettings["CacheConnection"]; _redisConnection = new Lazy(() => { return ConnectionMultiplexer.Connect(redisConnectionString); }); } private static IDatabase RedisDatabase { get { return _redisConnection.Value.GetDatabase(); } } public bool LockTake(string value, TimeSpan timeout) { return RedisDatabase.LockTake(value, Environment.MachineName, timeout); } public bool LockRelease(string value) { return RedisDatabase.LockRelease(value, Environment.MachineName); } }

Use:

if (_redisClientService.LockTake(lockKey, TimeSpan.FromMinutes(5))) { //Some processing _redisClientService.LockRelease(lockKey); }

I've tested locally and been able to successfully call the service to take and release a lock with no issue, however I get the exception above after deploying the code to a Basic SKU Azure App Service. I've flushed the cache from the console in Azure to be sure nothing was set locally that may be effecting the code that has been deployed. I've tried increasing the timeout in the connection string by adding syncTimeout=10000 to increase the timeout to 10000ms instead of the default 5000ms. I've also tried adding to my web.config that was suggested in another issue. Any ideas on why this timeout may be occurring, but isn't reproducible locally?



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有